package swust;

import java.util.Scanner;
import java.util.ArrayList;

public class PerfectNumber0044 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		for (int i = 2; i <= n; i++) {
			ArrayList<Integer> perfect = perfect(i);
			if (perfect != null) {
				System.out.print(i + " its fastors are");
				for (int j = 0; j < perfect.size(); j++) {
					System.out.print(" " + perfect.get(j));
				}
				System.out.println();
			}
		}
	}

	private static ArrayList<Integer> perfect(int n) {
		ArrayList<Integer> factors = new ArrayList<Integer>();
		double end = Math.sqrt((double) n);
		int sum = 1;
		factors.add(1);
		for (int i = 2; i < end; i++) {
			if (n % i == 0) {
				factors.add(i);
				factors.add(n / i);
				sum += i;
				sum += n / i;
			}
		}
		if (sum == n) {
			ArrayList<Integer> result = new ArrayList<Integer>();
			result.add(factors.get(0));
			int length = factors.size();
			for (int i = 1; i < length; i += 2) {
				result.add(factors.get(i));
			}
			for (int i = length - 1; i > 1; i -= 2) {
				result.add(factors.get(i));
			}
			int middle = length / 2;
			if (factors.get(middle).equals(factors.get(middle + 1))) {
				factors.remove(middle);
			}
			return result;
		} else {
			return null;
		}
	}
}
